using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class spell_bonus_data : MangosBase
	{
		public System.UInt32? entry;
		public System.Single? direct_bonus;
		public System.Single? dot_bonus;
		public System.Single? ap_bonus;
		public System.String comments;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}');", entry.GetValueOrDefault(), direct_bonus.GetValueOrDefault(), dot_bonus.GetValueOrDefault(), ap_bonus.GetValueOrDefault(), comments.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `spell_bonus_data` SET ");
			if(direct_bonus != null)
			{
				sb.AppendLine("`direct_bonus`='" + direct_bonus.Value.ToString() + "'");
			}
			if(dot_bonus != null)
			{
				sb.AppendLine("`dot_bonus`='" + dot_bonus.Value.ToString() + "'");
			}
			if(ap_bonus != null)
			{
				sb.AppendLine("`ap_bonus`='" + ap_bonus.Value.ToString() + "'");
			}
			if(comments != null)
			{
				sb.AppendLine("`comments`='" + comments.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
